import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

public class APP {
    public static void main(String[] args) {
        //得到Spring上下文
        ApplicationContext context=new ClassPathXmlApplicationContext("spring-config.xml");
        //BeanFactory beanFactory=new XmlBeanFactory(new ClassPathResource("spring-config.xml"));

        //加载Bean对象
        User user= (User) context.getBean("user");

        //使用Bean对象
        System.out.println(user.hello("world"));

    }
}
